home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource2 / sclib_1 / 1_6 / v7n6028a.txt < prev    next >
Encoding:
Text File  |  1995-11-01  |  640 b   |  32 lines

  1. #include <stdio.h>
  2.  
  3. struct {
  4.     char c1;
  5.     short s;
  6.     char c2;
  7.     int i;
  8.     char c3;
  9.     long l;
  10.     char c4;
  11.     float f;
  12.     char c5;
  13.     double d;
  14.     char c6;
  15.     int *p;
  16.     char c7;
  17. } structa;
  18.  
  19. main()
  20. {
  21.     printf("sizeof(structa) = %lu\n",
  22.         (unsigned long) sizeof(structa));
  23.     printf("&structa   = %p\n", (void *) &structa);
  24.     printf("&structa.s = %p\n", (void *) &structa.s);
  25.     printf("&structa.i = %p\n", (void *) &structa.i);
  26.     printf("&structa.l = %p\n", (void *) &structa.l);
  27.     printf("&structa.f = %p\n", (void *) &structa.f);
  28.     printf("&structa.d = %p\n", (void *) &structa.d);
  29.     printf("&structa.p = %p\n", (void *) &structa.p);
  30. }
  31.  
  32.